const axios = require('axios')
//登录接口
async function loginRequire(use,pass) {
    var key = await axios({
        withCredentials: true,
        method: 'get',
        baseURL:'http://jd.cctv005.com',
        url: '/login/cellphone',
        port: 3000,
        params: {
            phone: use,
            password: pass,
            timestamp: 1503019930000
        }
        
    })
    return key
}

//刷新登录状态
async function refreshLogin(use, pass) {
    var key = await axios({
        withCredentials: true,
        method: 'get',
        baseURL: 'http://jd.cctv005.com',
        url: '/login/refresh',
        port: 3000
    })
    return key
}

//获取用户关注信息
async function getAttention(id) {
    var info = await axios({
        method: 'get',
        baseURL: 'http://jd.cctv005.com',
        url: '/user/follows',
        port:3000,
        params: {
            uid:id
        }
    })
    return info
}
//获取用户基本信息
async function getInfo(id) {
    var info = await axios({
        method: 'get',
        baseURL: 'http://jd.cctv005.com',
        url: '/user/detail',
        port: 3000,
        params: {
            uid: id
        }
    })
    return info
}

//获取用户粉丝
async function getFans(id) {
    var info = await axios({
        method: 'get',
        baseURL: 'http://jd.cctv005.com',
        url: '/user/followeds',
        port: 3000,
        params: {
            uid: id
        }
    })
    return info
}

//获取用户动态

async function getDynamic(id) {
    var info = await axios({
        method: 'get',
        baseURL: 'http://jd.cctv005.com',
        url: '/user/event',
        port: 3000,
        params: {
            uid: id
        }
    })
    return info
}

//获取关注的歌手
async function getSinger() {
    var info = await axios({
        withCredentials: true,
        method: 'get',
        baseURL: 'http://jd.cctv005.com',
        url: '/artist/sublist',
        port: 3000,
        params: {
            //timestamp:1503019930000
        }
    })
    return info
}
export default {
    loginRequire,
    refreshLogin,
    getInfo,
    getAttention,
    getFans,
    getDynamic,
    getSinger
}